<template>
	<view class="fui-wrap">
		<fui-form labelColor="#7a7a7a" label-width="200" top="0" :show="false">
			<fui-form-item label="总车位数：">
				<fui-input backgroundColor="#eaeaea" readonly :borderBottom="false" :padding="['6rpx','6rpx','6rpx','26rpx']" :value="formData.parking_space_total"></fui-input>
			</fui-form-item>
			<fui-form-item label="在场车辆：">
				<fui-input backgroundColor="#eaeaea" readonly :borderBottom="false" :padding="['6rpx','6rpx','6rpx','26rpx']" :value="formData.parking_space_entry"></fui-input>
			</fui-form-item>
			<fui-form-item label="剩余车位：">
				<fui-input type="text" :borderBottom="false" :padding="['6rpx','6rpx','6rpx','26rpx']" v-model="formData.parking_space_last"></fui-input>
			</fui-form-item>
			<view class="fui-btn__box">
				<fui-button :disabled="disabledButton" text="确认校准" bold @click="submit"></fui-button>
			</view>
		</fui-form>
	</view>
</template>

<script>
	import {methods,baseUrl} from '@/utils/core.js';
	export default {
		data() {
			return {
				formData:{
					parking_space_total:'',
					parking_space_entry:'',
					parking_space_last:''
				},
				disabledButton:false
			}
		},
		onLoad(e) {
			this.$get('parking/index/spacelast').then(res=>{
				this.formData=res;
			});
		},
		methods: {
			...methods,
			submit:function(){
				if(this.formData.parking_space_last>this.formData.parking_space_total){
					this.$msg('剩余车位不能大于总车位');
					return;
				}
				this.$post('parking/index/spacelast',this.formData,true,true);
			}
		}
	}
</script>

<style lang="scss" scoped>
.fui-btn__box{
	padding: 20rpx;
}
</style>